A5.inktoSVG Method
Syntax
Arguments
- inkstring
The ink to get the SVG version of.
- settingsobject
Settings for the SVG.
- sizeobject
The size for the SVG returned.
- widthstringnumber
The width of the SVG. Values can be in CSS units (for example "2in"), a number of pixels, or "auto" (the default) to automatically adjust the width.
- heightstringnumber
The height of the SVG. Values can be in CSS units (for example "2in"), a number of pixels, or "auto" (the default) to automatically adjust the height.
- scalenumber
Size the SVG based on a scale of the ink. A value of "0.5" will be half the size of the ink, and "2" will be twice the size.
- boundsstringobject
The bounds of the area to convert to SVG. The default value is "page", and will show the entire ink page. If a more specific area is needed, an object must be passed in.
- typestring
The type of bonds to use. A value of "ink" will size the returned SVG to only show the boundaries of the actually drawn ink. A value of "explicit" will allow for an explicit clip area. All sizes will be in ink units.
- marginnumber
If the type if "ink" then a margin around the drawn ink can be specified.
- xnumber
The x position for an "explicit" bounds.
- ynumber
The y position for an "explicit" bounds.
- widthnumber
The width for an "explicit" bounds.
- heightnumber
The height for an "explicit" bounds.
- pageobject
Overrides for the ink page.
- backgroundboolean
Whether or not to include the ink background.
- linesboolean
Whether or not to include the ink page lines.
- attributesstring
Extra attributes to add to the SVG tag, for example 'class="myClass"'.
Returns
- svgstring
SVG string based on the ink and settings.
Description
Converts an ink format string to SVG.
Example
// assume the variable "inkStr" is an ink string. var svg = A5.ink.toSVG(inkStr,{ size: { width: '300px' }, // make the resulting SVG 300px wide bounds: { type: 'ink', margin: 20 }, // only show the drawn ink with a 20 ink unit margin page: { lines: false } // don't render page lines })